Trò chơi Pac-Man

20.586 lượt xem;
1 using UnityEngine;
2 using
System.Collections;
3 using
UnityEngine.UI;
4
5 public
class NameToTitle : MonoBehaviour {
6
7     
public Text title;
8
9
10     
void OnMouseEnter()
11     {
12         
switch(name)
13         {
14         
case "Pac-Man":
15             title.color = Color.yellow;
16             
break;
17
18         
case "Blinky":
19             title.color = Color.red;
20             
break;
21
22         
case "Pinky":
23             title.color =
new Color(254f/255f, 152f/255f, 203f/255f);
24             
break;
25
26         
case "Inky":
27             title.color = Color.cyan;
28             
break;
29
30         
case "Clyde":
31             title.color =
new Color(254f/255f, 203f/255f, 51f/255f);
32             
break;
33         }
34         
35         title.text = name;
36     }
37
38     
void OnMouseExit()
39     {
40         title.text =
"Pac-Man Clone";
41         title.color = Color.white;
42     }
43 }


Gõ tìm kiếm nhanh...